﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.Windows.Threading;
using System.Windows.Media.Media3D;

namespace N6SCRM.APP.Controls
{
    /// <summary>
    /// Interaction logic for AnimatedLogo.xaml
    /// </summary>
    public partial class AnimatedLogo : UserControl
    {

        private DispatcherTimer dispatcherTimer;

        public AnimatedLogo()
        {
            InitializeComponent();

            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Interval = TimeSpan.FromSeconds(12);
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.IsEnabled = true;

            Random r = new Random(DateTime.Now.Second);
            int a = (DateTime.Now.Second > 30) ? 1 : -1;
            DoubleAnimation tl = new DoubleAnimation(a * 360, TimeSpan.FromSeconds(8));
            tl.RepeatBehavior = RepeatBehavior.Forever;

            axisanglerotation.Axis = new Vector3D(r.Next(2), r.Next(2), 1);
            axisanglerotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, tl);

        }

        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            Random r = new Random();
            //text1.Text = str[r.Next(str.Length)] + " ";

            DoubleAnimation da = new DoubleAnimation(0, TimeSpan.FromSeconds(5));
            da.From = 0;
            da.To = 1;
            da.AutoReverse = true;
            //text1.BeginAnimation(TextBlock.OpacityProperty, da);
        }

        public new Double Height
        {
            set
            {
                this.Height = value;
                viewPort.Height = value;
            }
        }

        public new Double Width
        {
            set
            {
                this.Width = value;
                viewPort.Width = value;
            }
        }

    }
}
